import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import QStringListModel

#显示二维表格
class myQlistWidget(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("有时候我觉得自己像一只小小鸟")
        self.resize(500,300)

        self.listwidget=QListWidget()
        self.listwidget.resize(300,120)

        self.listwidget.addItem("Item1")
        self.listwidget.addItem("Item2")
        self.listwidget.addItem("Item3")
        self.listwidget.addItem("Item4")
        self.listwidget.addItem("Item5")
        self.listwidget.itemClicked.connect(self.clicked)
        self.setCentralWidget(self.listwidget)

    def clicked(self,index):
        QMessageBox.information(self,"QlistWidget","您选择了"+self.listwidget.item(self.listwidget.row(index)).text())

if __name__ == '__main__':
    app=QApplication(sys.argv)
    myc=myQlistWidget()
    myc.show()
    sys.exit(app.exec_())